import request from '@/utils/request'
import apis from '@/api/index'

export function getTradeList (parameter) {
  return request({
    url: apis.TradeList,
    method: 'get',
    params: parameter
  })
}

export function getIntentList (parameter) {
  return request({
    url: apis.IntentList,
    method: 'get',
    params: parameter
  })
}

export function getPurchaseList (parameter) {
  return request({
    url: apis.PurchaseList,
    method: 'get',
    params: parameter
  })
}

export function getAdd () {
  return request({
    url: apis.AddTrade,
    method: 'get'
  })
}

export function postAdd (data) {
  return request({
    url: apis.AddTrade,
    method: 'post',
    data: data
  })
}

export function getPurchaseView (id) {
  return request({
    url: `${apis.PurchaseView}?purchase_id=${id}`,
    method: 'get'
  })
}

export function getTradeView (id) {
  return request({
    url: `${apis.TradeView}?id=${id}`,
    method: 'get'
  })
}

export function batchImport (data) {
  return request({
    url: apis.BatchImport,
    method: 'post',
    data: data
  })
}

export function getEditIntent (id) {
  return request({
    url: `${apis.IntentEdit}?intent_id=${id}`,
    method: 'get'
  })
}

export function postEditIntent (id, data) {
  return request({
    url: `${apis.IntentEdit}?intent_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getEditPurchase (id) {
  return request({
    url: `${apis.PurchaseEdit}?purchase_id=${id}`,
    method: 'get'
  })
}

export function postEditPurchase (id, data) {
  return request({
    url: `${apis.PurchaseEdit}?purchase_id=${id}`,
    method: 'post',
    data: data
  })
}

export function postFeedback (id, data) {
  return request({
    url: `${apis.PurchaseFeedback}?purchase_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getCertTypeList (parameter) {
  return request({
    url: apis.CertTypeList,
    method: 'get',
    params: parameter
  })
}

export function addCertType (data) {
  return request({
    url: apis.AddCertType,
    method: 'post',
    data: data
  })
}

export function getCertList (parameter) {
  return request({
    url: apis.GetCertList,
    method: 'get',
    params: parameter
  })
}

export function getAddCert () {
  return request({
    url: apis.AddCert,
    method: 'get'
  })
}

export function postAddCert (data) {
  return request({
    url: apis.AddCert,
    method: 'post',
    data: data
  })
}

export function delCert (id) {
  return request({
    url: `${apis.DelCert}?id=${id}`,
    method: 'post'
  })
}
